package complexity;

public class Shell {
    public static void sort(Comparable[] arr){
        int length = arr.length;
        int h =length/2;
        while (h>=1){
            for (int i = h; i < length; i++) {
                for (int j = i; j >=h; j-=h) {
                    if (Bubble.greater(arr[j-h],arr[j])){
                        Bubble.exChange(arr,j-h,j);
                    }else break;
                }
            }
            if (h%2==0||h==1){
                h=h/2;
            }else h=h/2+1;
        }
    }
}
